package io.renren.modules.store.service.impl;

import io.renren.modules.store.dao.TStoreSellerDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.store.dao.TStoreStaffDao;
import io.renren.modules.store.entity.TStoreStaffEntity;
import io.renren.modules.store.service.TStoreStaffService;


@Service("tStoreStaffService")
public class TStoreStaffServiceImpl extends ServiceImpl<TStoreStaffDao, TStoreStaffEntity> implements TStoreStaffService {


    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TStoreStaffEntity> page = this.page(
                new Query<TStoreStaffEntity>().getPage(params),
                new QueryWrapper<TStoreStaffEntity>()
                .eq(!params.get("sellerId").equals(""),"seller_id",params.get("sellerId"))
                        .eq(!params.get("key").equals(""),"staff_name",params.get("key"))
                        .or()
                        .eq(!params.get("key").equals(""),"staff_no",params.get("key"))
        );

        return new PageUtils(page);
    }

}